﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:msxsl="urn:schemas-microsoft-com:xslt"
 xmlns:media='http://search.yahoo.com/mrss/'
 xmlns:yt='http://gdata.youtube.com/schemas/2007'
 exclude-result-prefixes="msxsl">
  <xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
  <xsl:template match="/">
    <xsl:element name="items">
      <xsl:for-each select="/rss/channel/item">
        <xsl:element name="item">
          <xsl:attribute name="title">
            <xsl:value-of select="title"/>
          </xsl:attribute>
          <xsl:attribute name="description">
            <xsl:value-of select="media:group/media:description" />
          </xsl:attribute>
          <xsl:attribute name="author">
            <xsl:value-of select="author" />
          </xsl:attribute>
          <xsl:attribute name="keywords" >
            <xsl:value-of select="media:group/media:keywords" />
          </xsl:attribute>
          <xsl:attribute name="videoId" >
            <xsl:value-of select="media:group/yt:videoid"/>
          </xsl:attribute>
          <xsl:attribute name="duration" >
            <xsl:value-of select="media:group/yt:duration/@seconds"/>
          </xsl:attribute>
          <xsl:attribute name="thumbnail" >
            <xsl:value-of select="media:group/media:thumbnail/@url"/>
          </xsl:attribute>
          <xsl:attribute name="viewcount" >
            <xsl:value-of select="yt:statistics/@viewCount"/>
          </xsl:attribute>
        </xsl:element>
      </xsl:for-each>
    </xsl:element>
  </xsl:template>
</xsl:stylesheet>